﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FluentValidation;
using Huirui.Cavan.Domain.MainBoundedContext.Resources;

namespace Huirui.Cavan.Domain.MainBoundedContext.SystemModule
{
    public class CustomerValidator : AbstractValidator<Customer>
    {
        public CustomerValidator()
        {
            RuleFor(d => d.Name).NotEmpty().WithMessage(Messages.Validate_NameNotEmpty);
            RuleFor(d => d.Corporation).NotNull().WithMessage(Messages.Validate_CorporationNotNull);
            RuleFor(d => d.Contact).NotEmpty().WithMessage("联系人不可为空");
            RuleFor(d => d.Mobile).NotEmpty().WithMessage(Messages.Validate_TelephoneMobileIsInvalid);
            RuleFor(d => d.Address).NotEmpty().WithMessage(Messages.Validate_AddressIsInvalid);          
        }
    }
}
